/** */
package co.com.umobile.network;

import android.content.Context;
import android.content.res.Resources;
import co.com.umobile.R;
import co.com.umobile.application.GlobalState;

/**
 * @author sergiogranada
 * 
 */
public class URLServiceConnection {

	/** login url id. */
	public static final int LOGIN_URL = R.string.login_url;

	/** subject list url id. */
	public static final int SUBJECT_LIST_URL = R.string.subject_list_url;

	/** place url id. */
	public static final int PLACE_LIST_URL = R.string.place_list_url;

	/** Subject detail list url id. */
	public static final int SUBJECT_DETAIL_LIST_URL = R.string.subject_detail_list_url;

	/** Notification url id. */
	public static final int NOTIFICATION_LIST_URL = R.string.notification_list_url;

	/**
	 * returns the service url.
	 * 
	 * @param context
	 *            context.
	 * @param urlId
	 *            urlId.
	 * @return String service url.
	 */
	public static String getURLService(Context context, int urlId) {

		Resources resources = context.getResources();

		String ip = ((GlobalState) context.getApplicationContext()).getHost();
		String port = ((GlobalState) context.getApplicationContext()).getPort();

		String url = String.format(resources.getString(urlId), ip, port);

		return url;
	}
}
